package com.tucy.logistics.common.enums;

import com.tucy.logistics.common.annotation.EnumAnnotation;
import com.tucy.logistics.common.base.EnumInterface;
import lombok.Getter;

/**
 * author: tcy
 * description:作业分配状态枚举
 */
@Getter
@EnumAnnotation
public enum AssignEnum implements EnumInterface {

    NO("no",1,"未分配"),
    YES("yes",2,"已分配");

    /**
     * 编码
     */
    private final String code;

    /**
     * 值
     */
    private final Integer value;

    /**
     * 键
     */
    private final String key;

    AssignEnum(String code, int value, String key) {
        this.code = code;
        this.value = value;
        this.key = key;
    }

    public static AssignEnum getByValue(Integer value) {

        AssignEnum baseEnum = null;

        for (AssignEnum item : values()) {
            if (item.getValue().equals(value)) {
                baseEnum = item;
                break;
            }
        }
        return baseEnum;
    }

}
